/**
 * 
 */
package com.antilia.infomaresme.provider;

import org.apache.wicket.model.LoadableDetachableModel;

import com.antilia.infomaresme.InfomaresmeApplication;
import com.antilia.infomaresme.data.dao.interfaces.IUserItemAlertsDao;
import com.antilia.infomaresme.data.dataobjects.UserItemAlert;

/**
 * @author Ernesto
 *
 */
public class UserItemAlertsLdm extends LoadableDetachableModel<UserItemAlert> {

	private static final long serialVersionUID = 1L;
	
	private Long id;

	
	/**
	 * @param object
	 */
	public UserItemAlertsLdm(UserItemAlert object) {
		super(object);
		if(object != null)
			this.id = object.getId();
	}

	/* (non-Javadoc)
	 * @see org.apache.wicket.model.LoadableDetachableModel#load()
	 */
	@Override
	protected UserItemAlert load() {
		if(id != null)
			return getItemDao().load(id);
		else return null;
	}

	protected IUserItemAlertsDao getItemDao() {
		return InfomaresmeApplication.getQAApplication().getAlertsDao();
	}
}
